import 'package:animations/animations.dart';
import 'package:flutter/material.dart';

class OpenContainerWrapper extends StatelessWidget {
  Widget? content;

  OpenContainerWrapper({
    required this.content,
    required this.closedBuilder,
    required this.transitionType,
    required this.onClosed,
  });

  final CloseContainerBuilder closedBuilder;
  final ContainerTransitionType transitionType;
  final ClosedCallback<bool?> onClosed;

  @override
  Widget build(BuildContext context) {
    return OpenContainer<bool>(
      transitionType: transitionType,
      openElevation: 0.0,
      closedElevation: 0.0,
      openBuilder: (BuildContext context, VoidCallback _) {
        return content ?? Container();
      },
      transitionDuration: const Duration(milliseconds: 500),
      onClosed: onClosed,
      tappable: false,
      closedBuilder: closedBuilder,
      openShape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(20.0)),
      ),
      closedShape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(2.0)),
      ),
    );
  }
}
